MAC 下搭建php开发环境
安装Homebrew
安装oh my zsh
1 2 3 4
| brew install zsh sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" vim ~/.zshrc 修改 ZSH_THEME="bira"
|
brew 安装php
1 2 3 4 5
| brew tap homebrew/dupes brew tap homebrew/versions brew tap homebrew/homebrew-php
brew install php70 --with-homebrew-curl
|
安装部分扩展
1 2 3
| brew install php70-swoole brew install php70-redis brew install php70-phalcon
|
验证是否正确安装
配置php-fpm
1 2 3 4 5
| vim /usr/local/etc/php/7.0/php-fpm.d/www.conf 修改 user = yourname 修改 group = staff vim /usr/local/etc/php/7.0/php-fpm.conf 修改 daemonize = yes
|
安装composer
找到一个地方作为自己的工作站
1 2 3 4 5 6
| cd ~ mkdir Apps cd Apps composer create-project limingxinleo/phalcon-project demo --prefer-dist cd demo php run
|
- 当看到以下信息 就代表安装无误了
1
| Success: The Storage was successfully created.
|
安装Nginx
1 2
| brew install nginx sudo nginx
|
- 打开浏览器输入127.0.0.1:8080就能看到nginx的欢迎界面了
配置Nginx
1
| cd /usr/local/etc/nginx/servers
|
- 并把demo.conf复制到当前文件夹中
修改文件 demo.conf
1 2
| server_name demo.app; root /Users/yourname/Apps/demo/public;
|
重启nginx 启动php-fpm
1 2
| sudo nginx -s reload sudo php-fpm
|
修改hosts
1 2
| sudo vim /etc/hosts 127.0.0.1 demo.app
|
查看效果
打开浏览器输入http://demo.app 即可看到效果
mac安装软件
https://www.jetbrains.com/toolbox/app/?fromMenu
建立软连接
1
| brew link php@7.1 --force
|